// 导入 axios.js
import instance from '@/utils/axios.js'

function userLogin ({ mobile, code }) {
  return instance({
    url: '/v1_0/authorizations',
    method: 'post',
    data: {
      mobile,
      code
    }
  })
}
export { userLogin }

import {getToken} from '@/utils/token.js'
function getUserInfo () {
  return instance({
    url: '/v1_0/user/profile',
    method: 'get',
    headers: {
      Authorization: `Bearer ${getToken().token}`
    }
  })
}
export { getUserInfo }

function editUserInfo(data) {
  return instance({
    url: '/v1_0/user/profile',
    method: 'PATCH',
    data,
    headers: {
      Authorization: `Bearer ${getToken().token}`
    }
  })
}
export { editUserInfo }


function editUserIcon(fd) {
  return instance({
    url: '/v1_0/user/photo',
    method: 'PATCH',
    data: fd,
    headers: {
      Authorization: `Bearer ${getToken().token}`
    }
  })
}
export { editUserIcon }